home *** CD-ROM | disk | FTP | other *** search
- Path: news.nchu.edu.tw!news
- From: bhughes@tscnet.com (Brian L. Hughes)
- Newsgroups: comp.lang.c++
- Subject: Re: Major problem with strings.
- Date: 11 Mar 1996 06:50:29 GMT
- Organization: Home
- Message-ID: <4i0ifl$kr8@news.nchu.edu.tw>
- References: <31438275.72DB@aol2.com>
- NNTP-Posting-Host: ip215.tscnet.com
- Mime-Version: 1.0
- Content-Type: Text/Plain; charset=US-ASCII
- X-Newsreader: WinVN 0.99.7
-
- In article <31438275.72DB@aol2.com>, neil@aol2.com says...
- >
- >Here's my code:
- >
- >1 char *club="";
- >2 club="/public_html/neil";
- >
- >3 strcat(club,argv[1]+5);
- >
- >4 strcat(club,"/");
- >
-
- club is defined as a pointer pointing to a constanst in memory.
- If you concatenate characters to the constant area you'll be wiping out
- something else.
-
- try
-
- char club[100];
-
- strcpy(club,"/public_html/neil";
- strcat(club, argv[1]+5);;
- strcat(club, "/");
-
-
-
- or
-
- CString club="/public_html/neil";
- club+=argv[1]+5;
- club+="/";
-
- or even less lines...
-
-